package com.neusoft.nepg.controller;


import com.neusoft.common.domain.Grider;
import com.neusoft.nepg.service.GriderService;
import jakarta.annotation.Resource;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


import java.util.Map;

@RestController
public class LoginController {

    @Resource
    GriderService griderService;

    //登录
    @PostMapping("/grider_login")
    public Map<String,Object> gLogin(@RequestBody Grider grider){
        String md5Hex = DigestUtils.md5DigestAsHex(grider.getPassword().getBytes());
        grider.setPassword(md5Hex);
        Map<String, Object> map=griderService.login(grider);
        return map;
    }


}
